<template>
  <div class="container">
    <baleTable :tableData="tableData" :tableHead="tableHead" :isSearch="true" :isTableRowClick="true"
      :tableLoading="tableLoading" :page="page" @pageSizeChange="pageSizeChange"
      @handleCurrentChange="handleCurrentChange" @searchMethods="searchMethods" @handleRowClick="handleRowClick"
      @tableSortChange="tableSortChange" ref="baleTable">
       <template #headLeft>
        <div
          class="ml10 tableStats-btn tableStats-btn-active"
          @click="edit"
        >
          退款规则设置
        </div>
      </template>
      <template #review_name="{ scope }">
        <span>{{
          scope.row.review_uid == "0" ? "系统" : scope.row.review_name
        }}</span>
      </template>
      <template #type="{ scope }">
        <span>微信支付</span>
      </template>
    </baleTable>

    <detail ref="orderDetail" @refresh="handleSelectTableType(tableType)"></detail>
    <el-dialog
    :visible.sync="dialogVisible"
    width="800px"
    :before-close="handleClose"
    :close-on-click-modal="false"
    append-to-body
    title="退款规则设置"
  >
       
    <div style="display:flex;    align-items: center;
    justify-content: center;">低于<el-input style="width:100px;margin:5px"></el-input>元退款系统自动审批</div>
    <div slot="footer" class="tx-c">
      <el-button @click="handleClose">取消</el-button>
      <el-button type="primary" @click="confirm('')" :loading="btnLoading"
        >确定</el-button
      >
    </div>
  </el-dialog>
  </div>
</template>

<script>
import { ApiOrderRefundList, ApiGetOrderDetail } from "@a/index";
import { tableHead } from "./config";
import tablePrImg from "@/components/tablePrImg.vue";

export default {
  components: {
    tablePrImg,

  },
  data() {
    return {
      tableHead,
      tableData: [],
      page: {
        page: 1,
        size: 25,
        total: 0,
      },
      tableLoading: false,
      searchParams: {},
      sortParams: {},
      editFormVisible: false,
      btnLoading: false,
      dialogVisible:false
    };
  },
  mounted() {
    this.getTableData();
  },
  methods: {
    edit(){
      this.dialogVisible = true
    },
    //编辑界面
    onEdit() { },
    showDialog(val) {
      this.$refs.DetailDialog.show(val);
    },
    userList(id) {
      this.$router.push({
        name: "detail",
        params: { id },
      });
    },
    getTableData(params = {}) {
      let postParams = {
        ...params,
        ...this.searchParams,
        ...this.sortParams,
        ...this.page,
      };
      this.tableLoading = true;
      ApiOrderRefundList(postParams).then((res) => {
        let { data, page } = res;
        this.tableData = data;
        this.page.total = page.total;
        this.tableLoading = false;
      });
    },
    searchMethods(params) {
      console.log("1111", params);
      this.searchParams = {};
      this.page.page = 1;
      this.searchParams = params;
      this.getTableData();
    },
    pageSizeChange(val) {
      this.page.size = val;
      this.getTableData();
    },
    handleCurrentChange(val) {
      this.page.page = val;
      this.getTableData();
    },
    tableSortChange(params) {
      if (params.sort_str) {
        this.sortParams = { ...this.sortParams, ...params };
      } else {
        delete this.sortParams.sort_str;
        delete this.sortParams.sort_order;
      }
      this.page.page = 1;
      this.getTableData();
    },
    handleRowClick(row) {
      ApiGetOrderDetail(row.row.order_id).then((res) => {
        this.$refs.orderDetail.show(res.data);
      });
    },
  },
};
</script>

<style lang="less" scoped></style>
